<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title>
</title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="css/ui-base.css">
<link rel="stylesheet" href="css/ui-box.css">
<link rel="stylesheet" href="css/ui-color.css">
<link rel="stylesheet" href="css/ui-img.css">
<link rel="stylesheet" href="css/pull.css">
<script src="js/jquery-2.0.0.js"></script>
<script src="js/iscroll.js"></script>
<script src="js/pull.js"></script>
<script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
	<script src="js/zy_tmpl.js">
	</script>
<script>
	
	function ResizePic(ImgD)
	{  
     var  image=new  Image();  
     image.src=ImgD.src;  
     if(image.width>0  &&  image.height>0)
     {  
       flag=true;  
       if(image.width/image.height>=  50/50)
       {  
         if(image.width>50)
  {      
           ImgD.width=50;  
           ImgD.height=(image.height*50)/image.width;  
         }
  else
         {  
           ImgD.width=image.width;      
           ImgD.height=image.height;  
         }  
       }  
       else
       {  
         if(image.height>50)
         {      
           ImgD.height=50;  
           ImgD.width=(image.width*50)/image.height;            
         }
         else
         {  
           ImgD.width=image.width;      
           ImgD.height=image.height;  
         } 
       }  
     }  
}    
</script>
</head>
<body class="um-vp" ontouchstart>
</body>
<script>
var url="http://tm.ourstu.com/api.php/user/listTopic.html";
zy_init();
window.uexOnload=function(type){
	if(!type){
		uexWindow.setBounce("1");
		uexWindow.showBounceView("0","#FFF","0");
		uexWindow.showBounceView("1","#FFF","0");
		loadWeibo();
	}
}
/*界面模版*/
var tmpl_no_com='<div  class="ub umh5 uinn3 unn b-gra c-wh uc-t1 uc-b1 ub-ver" style="border:1px solid #c5c5c5;3px 3px 6px rgba(180, 178, 178, 0.76) ">'
		+'<div class="ub">'
			+'<div class="umw3 umh5 umar-a" style="margin:0.6em"><div class="uabs umw3 umh5" onload="javascript:ResizePic(this)" style="background-image:url(${avatar_url});width:50px;height:50px"></div></div>'
			+'<div class="ub ub-f1 ub-ver">'
				+'<div class="ub" style="margin-top:0.4em; margin-left:0.3em">'
					+'<div class="ulev0 t-blu">${username}</div>'
					+'<div class="umw1"></div>'
					+'<div class="ub-f1"></div>'
					+'<div class="umw1"></div>'
				+'</div>'
				+'<div class="ub" style="margin-top:0.4em; margin-left:0.3em">'
					+'<div class="t-gra" style="font-size:0.7em; margin-top:0.5em">发布于：${ctime}</div>'
					+'<div class="umw1"></div>'
					+'<div class="ub-f1"></div>'
					+'<div class="umw1"></div>'
				+'</div>'
				+'<div class="ub-f1"></div>'
				
			+'</div>'
		+'</div>'
		+'<div class="ub-f1 " style="font-size:0.8em; margin-left:0.6em;margin-top:0.3em;margin-bottom:0.3em; letter-spacing:0.15em">${content}</div>'
		
		
		+'<div class="ub  t-wh c-bla c-m2 b-bla tx-c" style="background-color: rgb(235, 235, 235); border-top:1px solid #c5c5c5;">'
			+'<div class="ub ub-f1" style="padding-top:0.3em;padding-bottom:0.3em">'
				+'<input type="radio" name="rdi1" class="uhide" value="">'
				+'<div onclick="zy_for(event)" class="uinn5 ubl uc-l1 ub-f1 che t-bla imgPras" style="background-position:right; border:0px; "></div>'
				+'<div class="ub-f1 tx-l " style="padding-top:0.2em; border-right:1px solid rgb(161, 163, 168);;color: rgb(184, 180, 180); ">11</div>'
			+'</div>'
			+'<div style="margin-top:0.1em; border-top:1px solid #c5c5c5;display:block"></div>'
			+'<div class="ub ub-f1 ub-r1">'
				+'<input type="radio" name="rdi1" class="uhide" value="">'
				+'<div onclick="zy_for(event)" class="uinn5 ubl ub-f1 che t-bla imgComs" style="background-position:center;border-left: 0px solid rgb(161, 163, 168);"></div>'
			+'</div>'
		+'</div>'
		
	+'</div>';
var tmpl_com_1='<div  class="ub umh5 uinn3 unn b-gra c-wh uc-t1 uc-b1 ub-ver" style="border:1px solid #c5c5c5;3px 3px 6px rgba(180, 178, 178, 0.76) ">'
		+'<div class="ub">'
			+'<div class="umw3 umh5 umar-a" style="margin:0.6em"><div class="uabs umw3 umh5" onload="javascript:ResizePic(this)" style="background-image:url(${avatar_url});width:50px;height:50px"></div></div>'
			+'<div class="ub ub-f1 ub-ver">'
				+'<div class="ub" style="margin-top:0.4em; margin-left:0.3em">'
					+'<div class="ulev0 t-blu">${username}</div>'
					+'<div class="umw1"></div>'
					+'<div class="ub-f1"></div>'
					+'<div class="umw1"></div>'
				+'</div>'
				+'<div class="ub" style="margin-top:0.4em; margin-left:0.3em">'
					+'<div class="t-gra" style="font-size:0.7em; margin-top:0.5em">发布于：${ctime}</div>'
					+'<div class="umw1"></div>'
					+'<div class="ub-f1"></div>'
					+'<div class="umw1"></div>'
				+'</div>'
				+'<div class="ub-f1"></div>'
				
			+'</div>'
		+'</div>'
		+'<div class="ub-f1 " style="font-size:0.8em; margin-left:0.6em;margin-top:0.3em;margin-bottom:0.3em; letter-spacing:0.15em">${content}</div>'
		+'<div style="margin-top:0.1em; border-bottom:1px solid #c5c5c5;display:block"></div>'
		+'<div class="ub ub-ver" style="margin:0.3em;margin-left:0.5em">'
			
				+'<div class="ub ub-f1 ulev-1">'
					+'<div class=" t-bla">小鸡鸡：</div>'
					+'<div class=" t-gra">我的积极最大！</div>'
				+'</div>'
				
			+'</div>'
		+'</div>'
		+'<div class="ub  t-wh c-bla c-m2 b-bla tx-c" style="background-color: rgb(235, 235, 235); border-top:1px solid #c5c5c5;">'
			+'<div class="ub ub-f1" style="padding-top:0.3em;padding-bottom:0.3em">'
				+'<input type="radio" name="rdi1" class="uhide" value="">'
				+'<div onclick="zy_for(event)" class="uinn5 ubl uc-l1 ub-f1 che t-bla imgPras" style="background-position:right; border:0px; "></div>'
				+'<div class="ub-f1 tx-l " style="padding-top:0.2em; border-right:1px solid rgb(161, 163, 168);;color: rgb(184, 180, 180); ">11</div>'
			+'</div>'
			+'<div style="margin-top:0.1em; border-top:1px solid #c5c5c5;display:block"></div>'
			+'<div class="ub ub-f1 ub-r1">'
				+'<input type="radio" name="rdi1" class="uhide" value="">'
				+'<div onclick="zy_for(event)" class="uinn5 ubl ub-f1 che t-bla imgComs" style="background-position:center;border-left: 0px solid rgb(161, 163, 168);"></div>'
			+'</div>'
		+'</div>'
		
	+'</div>';
var tmpl_com_egt2='<div  class="ub umh5 uinn3 unn b-gra c-wh uc-t1 uc-b1 ub-ver" style="border:1px solid #c5c5c5;3px 3px 6px rgba(180, 178, 178, 0.76) ">'
		+'<div class="ub">'
			+'<div class="umw3 umh5 umar-a" style="margin:0.6em"><div class="uabs umw3 umh5" onload="javascript:ResizePic(this)" style="background-image:url(${avatar_url});width:50px;height:50px"></div></div>'
			+'<div class="ub ub-f1 ub-ver">'
				+'<div class="ub" style="margin-top:0.4em; margin-left:0.3em">'
					+'<div class="ulev0 t-blu">${username}</div>'
					+'<div class="umw1"></div>'
					+'<div class="ub-f1"></div>'
					+'<div class="umw1"></div>'
				+'</div>'
				+'<div class="ub" style="margin-top:0.4em; margin-left:0.3em">'
					+'<div class="t-gra" style="font-size:0.7em; margin-top:0.5em">发布于：${ctime}</div>'
					+'<div class="umw1"></div>'
					+'<div class="ub-f1"></div>'
					+'<div class="umw1"></div>'
				+'</div>'
				+'<div class="ub-f1"></div>'
				
			+'</div>'
		+'</div>'
		+'<div class="ub-f1 " style="font-size:0.8em; margin-left:0.6em;margin-top:0.3em;margin-bottom:0.3em; letter-spacing:0.15em">${content}</div>'
		+'<div style="margin-top:0.1em; border-bottom:1px solid #c5c5c5;display:block"></div>'
		+'<div class="ub ub-ver" style="margin:0.3em;margin-left:0.5em">'
			+'<div class="ub ub-f1">'
				+'<div class=" t-bla" style="font-size:0.95em">查看全部${comment_count}条评论</div>'
				+'<div class="umw1"></div>'
				+'<div class="ub-f1"></div>'
				+'<div class="umw1"></div>'
			+'</div>'
			+'<div class="ub ub-f2 ub-ver" style="margin-left:0.3em;margin-top:0.2em">'
				+'<div class="ub ub-f1 ulev-1">'
					+'<div class="t-bla">${comment_username1}：</div>'
					+'<div class=" t-gra">${comment_content1}</div>'
				+'</div>'
				+'<div class="ub ub-f1 ulev-1">'
					+'<div class=" t-bla">${comment_username2}：</div>'
					+'<div class=" t-gra">${comment_content2}</div>'
				+'</div>'
				
			+'</div>'
		+'</div>'
		+'<div class="ub  t-wh c-bla c-m2 b-bla tx-c" style="background-color: rgb(235, 235, 235); border-top:1px solid #c5c5c5;">'
			+'<div class="ub ub-f1" style="padding-top:0.3em;padding-bottom:0.3em">'
				+'<input type="radio" name="rdi1" class="uhide" value="">'
				+'<div onclick="zy_for(event)" class="uinn5 ubl uc-l1 ub-f1 che t-bla imgPras" style="background-position:right; border:0px; "></div>'
				+'<div class="ub-f1 tx-l " style="padding-top:0.2em; border-right:1px solid rgb(161, 163, 168);;color: rgb(184, 180, 180); ">11</div>'
			+'</div>'
			+'<div style="margin-top:0.1em; border-top:1px solid #c5c5c5;display:block"></div>'
			+'<div class="ub ub-f1 ub-r1">'
				+'<input type="radio" name="rdi1" class="uhide" value="">'
				+'<div onclick="zy_for(event)" class="uinn5 ubl ub-f1 che t-bla imgComs" style="background-position:center;border-left: 0px solid rgb(161, 163, 168);"></div>'
			+'</div>'
		+'</div>'
		
	+'</div>';
function loadWeibo(){
		$.getJSON(url,function(data)
		{
			if(data.success){
				window.localStorage["WeiboList"]=data;
			}
			var len=zy_tmpl_count(data.list);
			
			var i=0;
			
			for( i=0;i<len;i++)
			{	
				var obj=data.list[i];
				var arraryObj=new Array();
				var j=0;
				obj=userToArt(obj,obj.user);	
				var d=document.createElement('DIV');
				obj["ctime"]=addFriendlyTime(obj.create_time);
				
					if(parseInt(obj.comment_count)==0)
						var head=zy_tmpl_s(tmpl_no_com,obj,zy_tmpl_count(obj));//插入头部模版---评论数为零的模版
					else if(parseInt(obj.comment_count)==1)
					{
						
						obj=comment_user_ToArt(1,obj,obj.comment);
						var head=zy_tmpl_s(tmpl_no_com,obj,zy_tmpl_count(obj));//插入头部模版---评论数为1的模版
					}
					else{
						obj=comment_user_ToArt(2,obj,obj.comment);
						var head=zy_tmpl_s(tmpl_com_egt2,obj,zy_tmpl_count(obj));//插入头部模版---评论数>=2的模版
					}
				
				//d.setAttribute('id',user.uid);
				//var head=zy_tmpl_s(tmpl_no_com,obj,zy_tmpl_count(obj));//插入头部模版
				d.innerHTML=head;
				document.body.appendChild(d);
				
			}
			
  			
		},"json",function(e){
			
		},"GET","",true);
}
/*
	
*/
function comment_user_ToArt(count,obj,comment){
	if(count==1)
	{
		for(var item in comment)
		{
			obj["comment_content"]=item.content;
			obj["comment_username"]=item.user.username;
		}
		
		return obj;
	}
	else
	{
		for(var item in comment)
		{	
			item=comment[item];
			obj["comment_content1"]=item.content;
			obj["comment_username1"]=item.user.username;
			obj["comment_content2"]=item.content;
			obj["comment_username2"]=item.user.username;
		}
		return obj;
	}
}
/*
将父属性的一个对象内的所有属性转化成父属性的一个子属性
*/
function userToArt(father,son){
	father["uid"]=son.uid;
	father["username"]=son.username;
	father["avatar_url"]=son.avatar_url;
	return father;
}
/*
将时间戳转化成友好时间
*/
function addFriendlyTime(obj){
	var da=obj;
	da=parseInt(da)*1000;
	da=new Date(da);
	var year=da.getFullYear();
	var month=da.getMonth()+1;
	var date=da.getDate();
	//var time=da.Date();
	var nowDate=new Date();
	if(year!=nowDate.getFullYear())
	{
		str=year+'-'+month+'-'+date;
		
		return str;
	}	
	else
	{
		var monthin=nowDate.getMonth()-month;
		if(monthin==0)
		{
			dayin=nowDate.getDate()-date;
			if(dayin==0)
			{
				
				
				return da.getHours()+':'+da.getMinutes();
			}
			else if(dayin==1)
			{
				
				return "昨天"+da.getHours()+':'+da.getMinutes();
			}
			else
			{	
				var m=parseInt(da.getMonth())+1;
			
				return m+'-'+da.getDate();
			}
		}
		else{
			var m=parseInt(da.getMonth())+1;
			
			return m+'-'+da.getDate();
		}
		
	}
}
</script>
</html>
